#include <iostream>

struct Container {
    int i;
    double d;
};

void ReadContainerInt(double *ptr)
{
    std::cout << "double address: " << (void *)ptr << std::endl;
    auto container = reinterpret_cast<struct Container *>(
        (char *)ptr - offsetof(struct Container, d)
    );
    std::cout << "container address: " << (void *)container << std::endl;
    std::cout << "i: " << container->i << std::endl;
    std::cout << "d: " << container->d << std::endl;
}

int main()
{
    Container c = {12345678, 1.23456};
    ReadContainerInt(&c.d);
    return 0;
}
